package Day26.java.deom02;

import com.google.gson.Gson;

public class Demo02 {
    public static void main(String[] args) {
        // 创建Gson对象
        Gson g = new Gson();
        //转换  {"name":"金苹果","id":"100","info":"种植苹果真辛苦"}
        Book b = g.fromJson("{\"name\":\"金苹果\",\"id\":\"100\",\"info\":\"种植苹果真辛苦\"}",Book.class);
        System.out.println(b.getName());
    }
}
